(function() {
	const response = {
		type: 'page',
		title: '待入库资产概览',
		"toolbar": [
			{
				"type": "button",
				"label": "前往登录",
				"onEvent": {
					"click": {
						"actions": [
							{
								"args": {
									"url": "/index.html"
								},
								"actionType": "url"
							}
						]
					}
				},
				"id": "u:0ab60fdf7028"
			}
		],

		body:[

			{
				"type": "form",
				"api": "post:/assetManager/getExcelData",
				title: "批量导入",
				"body": [
					{
						"type": "input-excel",
						"name": "excel",
						"label": "上传入库资产信息excel文件"
					}
				]
			},
				{
				type: "crud",
				syncLocation: false,
				"api": "post:/assetManager/getUnassignedAsset",
				loadDataOnce: true,
				"headerToolbar": [

					{
						"type": "export-excel",
						"api": "post:/assetManager/getUnassignedAsset",
						filename: "待分库资产",
						//自定义导出列
						columns:[
							"id",
							"assetId",
							"assetName",
							"supplier",
							"life",
							"classes",
						]
					},{
						type: "reload"
					}
				],
				"autoFillHeight": true,
				"source": "${items | filter:id:match:idFilter|filter:classes:match:classesFilter|filter:supplier:match:supplierFilter}",
				"filter": {
					"title": "条件搜索",
					"body": [
						{
							"type": "input-text",
							"name": "idFilter",
							"label": "资产编号"
						},
						{
							"type": "input-text",
							"name": "classesFilter",
							"label": "资产类别"
						},
						{
							"type": "input-text",
							"name": "supplierFilter",
							"label": "供应商"
						},

					]
				},
				columns:[
					{
						id: "assetRealId",
						name: "id",
						label: "资产编号",
					},
					{
						name: "assetId",
						hidden: "true"
					},
					{
						name: "assetName",
						label: "资产名"
					},
					{
						name: "supplier",
						label: "供应商"
					},
					{
						name: "life",

						label: "有效期至"
					},
					{
						name: "classes",
						label: "资产类别"
					},
					{
						type: "operation",
						label: "操作",
						width: 100,
						buttons: [
							{
								label: "申请入库",
								type: "button",
								name: "importButton",

								actionType: "dialog",

								dialog: {
									title: "请选择目标仓库",
									body:[
											{
												type: "service",//功能性容器，保存资产id
												data:{
													assetRealId: "${id}"
												},
												body:[
													{
														type: "tpl",
														tpl: "${assetRealId}",
														hidden: true
													},
													{
														type: "crud",
														api: {
															method: "post",
															url: "/assetManager/getEnableImportRepositories",
															data: "${id|toInt}"

														},//获取目前选中的资产id
														columns:[
															{
																name: "id",
																label: "仓库id",
																// hidden: "true"
															},
															{
																name: "repositoryName",
																label: "目标仓库"
															},
															{
																"type": "operation",
																"label": "操作",
																"width": 100,
																"buttons": [
																	{
																		type: "button",
																		label: "申请入库",
																		actionType: "ajax",//资产管理员创建入库申请
																		api: {
																			method: "post",
																			url: "/assetManager/insertAssetImport",
																			data:{
																				"assetId": "${assetRealId}",
																				"repositoryId": "${id}"
																			},
																			close: true
																		},
																		"onEvent": {
																			"click": {
																				"actions": [
																					{
																						"actionType": "refresh"
																					}
																				]
																			}
																		}//刷新页面
																	}
																]
															}

														]
													}
												]
											}
									]
								}
							}
						]
					}
				]


			}
		]
	}

	window.jsonpCallback && window.jsonpCallback(response);
})();
